<?php


    // Author: Tomasz Durka
    // Date: 22nd February 2007
    // Prints out a link for PHP nails
    
    
  function image ($src, array $params = array()) {
    
    
    $border = ' border="0"';
    $align = '';
    
    foreach ($params as $_key => $_val) {
      switch($_key) {
        case 'border':
        case 'class':
        case 'style':
        case 'align':
        case 'id':
          $$_key = " {$_key}=\"{$_val}\"";
          break;
      }
    }
    
    if(preg_match('/^(?:https?:\/\/|\/)/', $src)) {
      return "<img src=\"{$src}\"{$border}{$class}{$id}{$style} />";
    } else {
      return "<img src=\"/images/{$src}\"{$border}{$class}{$id}{$style}{$align} />";
    }
    
  }

?>